package com.enation.app.javashop.consumer.shop.shop;

import com.enation.app.javashop.consumer.core.event.ShopNameChangeEvent;
import com.enation.app.javashop.core.client.goods.GoodsClient;
import com.enation.app.javashop.core.shop.model.vo.ShopNameChangeMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 店铺信息同步
 *
 * @author Chopper
 * @version v1.0
 * @since v7.0
 * 2018-12-10 下午4:05
 */
@Component
public class ShopDataSynchroConsumer implements ShopNameChangeEvent {


    @Autowired
    private GoodsClient goodsClient;

    /**
     * 店铺名称改变消息
     *
     * @param shopNameChangeMsg 店铺名称改变消息
     */
    @Override
    public void shopNameChange(ShopNameChangeMsg shopNameChangeMsg) {
        goodsClient.changeSellerName(shopNameChangeMsg.getShopId(), shopNameChangeMsg.getShopName());
    }
}